﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace ChinaSoft.Web.Model_tb_MidSoft_UserHaveRoles
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(!PageValidate.IsNumber(txtUsersId.Text))
			{
				strErr+="用户ID格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtRolesId.Text))
			{
				strErr+="角色ID格式错误！\\n";	
			}
			if(!PageValidate.IsDateTime(txtCreateTime.Text))
			{
				strErr+="创建时间格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtCreateUserId.Text))
			{
				strErr+="创建人ID格式错误！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			int UsersId=int.Parse(this.txtUsersId.Text);
			int RolesId=int.Parse(this.txtRolesId.Text);
			DateTime CreateTime=DateTime.Parse(this.txtCreateTime.Text);
			int CreateUserId=int.Parse(this.txtCreateUserId.Text);

			ChinaSoft.Model.Model_tb_MidSoft_UserHaveRoles model=new ChinaSoft.Model.Model_tb_MidSoft_UserHaveRoles();
			model.UsersId=UsersId;
			model.RolesId=RolesId;
			model.CreateTime=CreateTime;
			model.CreateUserId=CreateUserId;

			ChinaSoft.BLL.BLL_tb_MidSoft_UserHaveRoles bll=new ChinaSoft.BLL.BLL_tb_MidSoft_UserHaveRoles();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
